package jiakuang;
import java.util.ArrayList;
import java.util.List;
public class test {
    public static void main(String[] args) {
        learn3 te=new learn3("朱玉",12);
        learn3 te1=new learn3("张三",13);
        learn3 te2=new learn3("李四",14);
        learn3 te3=new learn3("朱玉",12);
        //创建集合
        List list=new ArrayList();
        //添加数据
        list.add(te);
        list.add(te1);
        list.add(te2);
        list.add(te3);
        //遍历集合
       for(int i=0;i<list.size()-1;i++){
           learn3 th=(learn3) list.get(i);
           for(int j=i+1;j<list.size()-i-1;j++){
           learn3 th1=(learn3) list.get(j);
               if (th.getName().equals(th1.getName()) && (th.getAge()==th1.getAge())){
                   list.remove(th);
       }
    }
           System.out.println(th.getAge());
}
    }
}

